/*
 * $Header: $
 * $Id$
 *
 * Copyright (c) 2011, Mike DePhillips. All Rights Reserved.
 * This code may not be used without the express written permission
 * of the copyright holder, Mike DePhillips.
 */

package com.facebook.bannermaker.android.activity.makebanner;

import java.io.ByteArrayOutputStream;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
import android.view.Window;

import com.facbook.bannermaker.android.util.ActivityUtil;
import com.facebook.bannermaker.android.R;
import com.facebook.bannermaker.android.util.AppConstants;

/**
 * Activity for browsing inbox and acquiring tasks
 *
 * @author Michael DePhillips
 * 
 */
public class MakeBannerTutorialActivity extends Activity {

	String m_id;
	String m_filePath;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE); 
        setContentView(R.layout.tutorial_activity);  

        // get the facebook id and file path to the image from the last activity
        Bundle bundle = getIntent().getExtras();
        if( bundle != null ) {
            m_id = bundle.getString(AppConstants.JSON_ME_ID);
            m_filePath = bundle.getString(AppConstants.IMAGE_FILEPATH);
        }
    }    
    
    public void onSkipClicked(View v) {
    	
    	// save editor's preferences that the user has viewed the tutorial
    	SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    	SharedPreferences.Editor editor = preferences.edit();
    	editor.putBoolean(AppConstants.FIRST_TIME_USE, false);
    	editor.commit();
    	
        // otherwise,send data to the banner maker activity
        ActivityUtil.loadMakeBannerFromMemoryActivity(this, m_id, m_filePath);
        finish();
    }
}